<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>
<body>
  <script>
    function Random() {
      this.num = Math.floor(Math.random() * 10 + 1);
    }
    Random.prototype.show1 = function () {
      setInterval(function () {
        console.log(this.num);
      }.bind(this), 500);
    }
    Random.prototype.show2 = function () {
      this.show1();
    }
    var rm = new Random();
    rm.show2();
  </script>
</body>
</html>
